import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'Login',
      component: () => import('@/views/Main/LoginView.vue'),
      path: '/',
      name: 'Login',
      component: () => import('@/views/Main/LoginView.vue'),
    },
    {
      path: '/Main',
      name: 'Main',
      component: () => import('@/views/Main/Menu.vue'),
      children: [
        {
          path: '/GetPermission',
          name: 'GetPermission',
          component: () => import('@/views/RBAC/GetPermission.vue'),
      children: [
        {
          path: '/GetPermission',
          name: 'GetPermission',
          component: () => import('@/views/RBAC/GetPermission.vue'),
        },
        {
          path: '/GetRole',
          name: 'GetRole',
          component: () => import('@/views/RBAC/GetRoleView.vue'),
          path: '/GetRole',
          name: 'GetRole',
          component: () => import('@/views/RBAC/GetRoleView.vue'),
        },
        {
          path: '/GetUser',
          name: 'GetUser',
          component: () => import('@/views/RBAC/GetUserView.vue'),
        },
        //#region 工艺流程
        {
          path: '/ShowProcessFlows',
          name: 'ShowProcessFlows',
          component: () => import('@/views/工艺流程/ShowProcessFlowsView.vue'),
        },
        {
          path: '/AddProcessFlow',
          name: 'AddProcessFlow',
          component: () => import('@/views/工艺流程/AddProcessFlowView.vue'),
        },
        {
          path: '/EditProcessFlow/:id',
          name: 'EditProcessFlow',
          component: () => import('@/views/工艺流程/EditProcessFlowView.vue'),
        },
        {
          path: '/ViewProcessFlow/:id',
          name: 'ViewProcessFlow',
          component: () => import('@/views/工艺流程/ViewProcessFlowView.vue'),
        },
        //#endregion
        //#region 物品管理
        {
           path: '/ShowItems',
           name: 'ShowItems',
           component: () => import('@/views/物品管理/ShowItemsView.vue'),
        },
        {
           path: '/items/add',
           name: 'AddItem',
           component: () => import('@/views/物品管理/AddItemView.vue'),
        },
        {
           path: '/items/maintain/:id',
           name: 'MaintainItem',
           component: () => import('@/views/物品管理/MaintainItemView.vue'),
        },
        {
           path: '/items/view/:id',
           name: 'ViewItem',
           component: () => import('@/views/物品管理/ViewItemView.vue'),
        },
        //#endregion
        //#region 内部生产
        {
           path: '/ShowInternalProduction',
           name: 'ShowInternalProduction',
           component: () => import('@/views/内部生产/ShowInternalProductionView.vue'),
        },
        {
           path: '/internal-production/add',
           name: 'AddInternalProduction',
           component: () => import('@/views/内部生产/AddInternalProductionView.vue'),
        },
        {
           path: '/internal-production/view/:id',
           name: 'ViewInternalProduction',
           component: () => import('@/views/内部生产/ViewInternalProductionView.vue'),
        },
        {
           path: '/internal-production/edit/:id',
           name: 'EditInternalProduction',
           component: () => import('@/views/内部生产/EditInternalProductionView.vue'),
        },
          path: '/ShowItems',
          name: 'ShowItems',
          component: () => import('@/views/物品管理/ShowItemsView.vue'),
        },
        //#endregion
        {
          path: '/WarehouseManagement',
          name: 'WarehouseManagement',
          component: () => import('@/views/Warehouse/WarehouseManagement.vue'),
        },
        {
          path: '/SupplierManagement',
          name: 'SupplierManagement',
          component: () => import('@/views/Supplier/SupplierManagement.vue'),
        },
        {
          path: '/CustomerManagement',
          name: 'CustomerManagement',
          component: () => import('@/views/Customer/CustomerManagement.vue'),
        },
        {
          path: '/PurchaseOrderList',
          name: 'PurchaseOrderList',
          component: () => import('@/views/PurchaseOrder/PurchaseOrderList.vue'),
        },
        {
          path: '/PurchaseOrderDetail/:id',
          name: 'PurchaseOrderDetail',
          component: () => import('@/views/PurchaseOrder/PurchaseOrderDetail.vue'),
        },
        {
          path: '/IncomingInspectionList',
          name: 'IncomingInspectionList',
          component: () => import('@/views/IncomingInspection/IncomingInspectionList.vue'),
        },
        {
          path: '/IncomingInspectionDetail/:id',
          name: 'IncomingInspectionDetail',
          component: () => import('@/views/IncomingInspection/IncomingInspectionDetail.vue'),
        },
        //#region 销售订单
        {
          path: '/SalesOrderList',
          name: 'SalesOrderList',
          component: () => import('@/views/SalesOrder/SalesOrderList.vue'),
        },
        {
          path: '/SalesOrderDetail/:id',
          name: 'SalesOrderDetail',
          component: () => import('@/views/SalesOrder/SalesOrderDetail.vue'),
        },
        //#endregion
        {
          path: '/GetUser',
          name: 'GetUser',
          component: () => import('@/views/RBAC/GetUserView.vue'),
        },
        {
          path: '/ProcessTypeShow',
          name: 'ProcessTypeShow',
          component: () => import('@/views/Process/ProcessTypeShow.vue'),
        },
        {
          path: '/ProcessShow',
          name: 'ProcessShow',
          component: () => import('@/views/Process/ProcessShow.vue'),
        },
        {
          path: '/OutsourcingShow',
          name: 'OutsourcingShow',
          component: () => import('@/views/Process/OutsourcingShow.vue'),
        },
        {
          path: '/OutsourcingWorkOrder',
          name: 'OutsourcingWorkOrder',
          component: () => import('@/views/Process/OutsourcingWorkOrder.vue'),
        },
        {
          path: '/ApprovalManagement',
          name: 'ApprovalManagement',
          component: () => import('@/views/Process/ApprovalManagement.vue'),
        },
        {
          path: '/OutboundOrderManagement',
          name: 'OutboundOrderManagement',
          component: () => import('@/views/Process/OutboundOrderManagement.vue'),
        },
        // 入库管理
        {
          path: '/InboundList',
          name: 'InboundList',
          component: () => import('@/views/Inbound/InboundList.vue'),
        },
        {
          path: '/InboundDetail/:id',
          name: 'InboundDetail',
          component: () => import('@/views/Inbound/InboundDetail.vue'),
        },
        {
          path: '/InboundCreate',
          name: 'InboundCreate',
          component: () => import('@/views/Inbound/InboundForm.vue'),
        }
      ]
    },
    {
      path: '/about',
      name: 'about',
      // route level code-splitting
      // this generates a separate chunk (About.[hash].js) for this route
      // which is lazy-loaded when the route is visited.
      component: () => import('../views/AboutView.vue'),
    }
  ],
})

export default router
